<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <script src="../../../vue.js"></script>
  </head>

  <body>
    <div id="app">
      <table width="300" border="1" style="border-collapse: collapse">
        <tr>
          <th>是否选中</th>
          <th>商品名称</th>
          <th>备注</th>
        </tr>
        <tr v-for="item in shopCar" :key="item.id">
          <th>
            <input type="checkbox" v-model="item.isChecked" />
          </th>
          <th>{{item.name}}</th>
          <th></th>
        </tr>
      </table>
      <div><input type="checkbox" v-model="allCheck" /> 全选</div>
    </div>
    <script>
      Vue.config.productionTip = false;

      const vm = new Vue({
        el: "#app",
        data() {
          return {
            shopCar: [
              { id: 1, name: "素力高猫粮", isChecked: false },
              { id: 2, name: "抗原试纸", isChecked: false },
              { id: 3, name: "布洛芬缓释胶囊", isChecked: false },
            ],
          };
        },

        computed: {
          allCheck() {
            return this.shopCar.every((item) => item.isChecked);
          },
        },
      });
    </script>
  </body>
</html>
